from  pyecharts import options as opts
from pyecharts.charts import  Bar
#设置X轴坐标数据
x_data = ['[90~100]','[80~90)','[70~80)','[60~70)','[0~60)']
#设置Y轴坐标数据
y_data = [1,14,14,5,8]
#设置柱形图
bar = (
    Bar()
    .add_xaxis(x_data)
    .add_yaxis("成绩-人数",y_data)
    .set_global_opts(
        tooltip_opts=opts.TooltipOpts(),
        #提示框配置项
        xaxis_opts=opts.AxisOpts(name='成绩',
                                 name_location='middle',
                                 name_gap=30,
                                 name_rotate=45,
                                 #分割线配置项
                                 splitline_opts=opts.SplitLineOpts (
                                     is_show=True,
                                     linestyle_opts=
                                     opts.LineStyleOpts(width=4))
                                 ),
        #y轴配置项
        yaxis_opts=opts.AxisOpts(name='人数',name_gap=30,name_rotate=45)

    )
)
bar.render("d:/html/task6-15.html")